package com.example.rabbitmq_server;

/**
 * @author yifs
 * @version 1.0
 * @date 2024/3/28 9:22
 */
// Main.java
import com.example.rabbitmq_server.file.DownloadController;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;

import java.io.IOException;

public class Main extends Application {

    @Override
    public void start(Stage primaryStage) {
        try {
            FXMLLoader loader = new FXMLLoader(getClass().getResource("/views/Download.fxml")); // 使用getClass.getResource加载相对路径下的FXML文件
            Parent root = loader.load();
            Scene scene = new Scene(root);
            // 加载CSS样式
            scene.getStylesheets().add(getClass().getResource("/style/style.css").toExternalForm());
            primaryStage.setTitle("文件下载器");
            primaryStage.setScene(scene);
            primaryStage.show();
            // 获取FXML中定义的控制器并初始化相关功能
            DownloadController controller = loader.getController();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    public static void main(String[] args) {
        launch(args);
    }
}
